package com.hy.hongying.controller;

import com.hy.hongying.bo.VideoCommintAddBo;
import com.hy.hongying.config.SystemConfig;
import com.hy.hongying.service.intf.VideoCommintService;
import com.hy.hongying.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@CrossOrigin
@Api(tags = "视频评论文档")
@RestController
@RequestMapping("/hy/videoCommintController/")
public class VideoCommintController {
    @Autowired
    private VideoCommintService service;
    @ApiOperation("上传时评评论，当rep为0师上传视频评论，vid为0是上传评论中的评论")
    @PostMapping("insertVideoCommint.do")
    public R insertVideoCommint(HttpServletRequest request,@RequestBody VideoCommintAddBo bo){
       return service.insertVideoCommint(request.getHeader(SystemConfig.USER_TOKEN),bo);
    }

    @ApiOperation("查看自己的评论")
    @PostMapping("selectMyVideoCommint.do")
    public R selectMyVideoCommint(HttpServletRequest request,Integer uid){
      return service.selectMyVideoCommint(request.getHeader(SystemConfig.USER_TOKEN),uid);
    }
    @ApiOperation("删除自己的评论")
    @PostMapping("delMyVideoCommint.do")
    public R delMyVideoCommint(HttpServletRequest request,Integer cid){
        return service.delMyVideoCommint(request.getHeader(SystemConfig.USER_TOKEN),cid);
    }
    @ApiOperation("查看视频的评论，以及每条评论的子品论数量")
    @PostMapping("selectVideoCommint.do")
    public R selectVideoCommint(Integer vid){
      R r = service.selectVideoCommint(vid);
      return r;
    }
    @ApiOperation("查看评论的评论，以及每条评论的评论子品论数量")
    @PostMapping("selectVideoCommints.do")
    public R selectVideoCommints(Integer cid){
        R r = service.selectVideoCommints(cid);
        return r;
    }




}
